﻿using System;
using System.Xml;
using SecurityTokenServiceNS;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Xml.Linq;
using System.AddIn.Hosting;
using System.AddIn.Pipeline;
using System.IdentityModel.Tokens;

namespace SecurityTokenServiceNS
{
    public class RSTProcessor
    {
        public static RST CreateFrom(XmlReader xr, XNamespace namespaceUri)
        {
            XElement xRst = XElement.ReadFrom(xr) as XElement;
			RST rst = new RST(namespaceUri);

			foreach (IRSTProcessor rstp in AddInTool.RstProcessorAddIns)
				rstp.ProcessMessage(rst, xRst);

            Console.WriteLine("RST successfully created.");
            return rst;
        }
    }

}
